﻿namespace ChinaUnicom.Models
{
    using System.ComponentModel;
    using System;

    public class Product : INotifyPropertyChanged
    {
        public Product()
        {
            Started = DateTime.MinValue;
            Ended = DateTime.Now.AddYears(1);
        }

        string name;
        public string Name
        {
            get { return name; }
            set
            {
                if (value != name)
                {
                    name = value;
                    NotifyPropertyChanged("Name");
                }
            }
        }

        DateTime started;
        public DateTime Started
        {
            get { return started; }
            set
            {
                if (value != started)
                {
                    started = value;
                    NotifyPropertyChanged("Started");
                }
            }
        }

        DateTime ended;
        public DateTime Ended
        {
            get { return ended; }
            set
            {
                if (value != ended)
                {
                    ended = value;
                    NotifyPropertyChanged("Ended");
                }
            }
        }

        string description;
        public string Description
        {
            get { return description; }
            set
            {
                if (value != description)
                {
                    description = value;
                    NotifyPropertyChanged("Description");
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
